package com.zmx.piglearn.activity

import android.app.Activity

class ActivityCollector {
    companion object {
        private val activities = mutableListOf<Activity>()

        fun add(activity: Activity) {
            activities.add(activity)
        }

        fun remove(activity: Activity) {
            activities.remove(activity)
        }

        fun finishAll() {
            for (activity in activities) {
                if (!activity.isFinishing) {
                    activity.finish()
                }
            }
        }
    }
}